<?php
include_once '../Login/databaseconnection.php';
$Started_year=$_POST['Year'];
$Institute=$_POST['Institute'];
   $Teacher_NIC=$_SESSION['Teacher_NIC'];
   $Training_Id=$_SESSION['Training_Id'];
$_SESSION['Tra_Id']=$_SESSION['Training_Id'];
   $_SESSION['Tea_NIC']=$_SESSION['Teacher_NIC'];
	 $Training_Idc=$_POST['Training_Idc'];
	 $Teacher_NICc=$_POST['Teacher_NICc'];
      $Duration=$_POST['Duration'];
      date_default_timezone_set("Europe/Paris");
    $t_d=date("Y/m/d");
   
   if($Training_Idc==""||$Teacher_NICc==""||$Duration=="" )
	{
		   $_SESSION['errorin']="Please check your inputs!";
	 }
	else
	{
$sql=mysql_query("UPDATE training_details SET Year='$Started_year',Institute='$Institute',Training_Id='$Training_Idc',Teacher_NIC='$Teacher_NICc',Duration='$Duration',Last_Updated_Date='$t_d' WHERE Training_Id='$Training_Id' AND Teacher_NIC='$Teacher_NIC' ");

 if(mysql_affected_rows()!=0)
  {
$_SESSION['error']="This record is successfully updated!";
  }
  if(mysql_affected_rows()==0)
  {
 $_SESSION['error']="Sorry unable to update this record!";
  }
	
}
  ?>

